from django.urls import re_path, include, path

from utils.addons.router import CustomRouter
from account.views import LoginViewSet, TestViewSet
from rest_framework_simplejwt.views import (
    TokenRefreshView,
    TokenBlacklistView
)
from utils.decorators.common import add_attr

TokenRefreshView.post = add_attr(risk_level=0)(TokenRefreshView.post)
TokenBlacklistView.post = add_attr(risk_level=0)(TokenBlacklistView.post)

router = CustomRouter()

router.register('login', LoginViewSet)
router.register('test', TestViewSet)

urlpatterns = [
    re_path(r'^', include(router.urls)),
    path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('logout/', TokenBlacklistView.as_view(), name='token_blacklist'),
]
